import request from '@/utils/request'
/**
 * 分页代理人列表
 * @param pageNum
 * @param pageSize
 */
const getList = function(pageNum,pageSize) {
  return request({
    url: '/SysAgent/list?pageNum='+pageNum+"&pageSize="+pageSize,
    method: 'get',
    data: {}
  })
}

/**
 * 删除
 * @param id
 */
const deleted = function(ids) {
  return request({
    url: '/SysAgent/delete',
    method: 'post',
    data: {
      ids: ids
    }
  })
}

/**
 * 更新
 * @param data
 */
const update = function(data) {
  return request({
    url: '/SysAgent/update',
    method: 'post',
    data: data
  })
}

/**
 * 添加
 * @param data
 */
const add = function(data) {
  return request({
    url: '/SysAgent/save',
    method: 'post',
    data: data
  })
}

const getPayType = function(agentId) {
  return request({
    url: '/SysAgent/getPayType',
    method: 'get',
    params: {
      agentId: agentId
    }
  })
}

const addPay = function(agentPay) {
  return request({
    url: '/SysAgent/addPay',
    method: 'post',
    data: agentPay
  })
}
const deletePay = function(id) {
  return request({
    url: '/SysAgent/deletePay',
    method: 'get',
    params: {
      id: id
    }
  })
}

const listDictByPCode = function(pCode) {
  return request({
    url: '/dict/listDictByPCode',
    method: 'post',
    data: {
      pCode: pCode
    }
  })
}

export const agentApi = {
  getList: getList,
  deleted: deleted,
  update: update,
  add: add,
  getPayType: getPayType,
  addPay: addPay,
  deletePay: deletePay,
  listDictByPCode: listDictByPCode
}
